home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / lt_setattributes.c < prev    next >
C/C++ Source or Header  |  1999-04-19  |  33KB  |  1,527 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. /*****************************************************************************/
  15.  
  16. #include <stdarg.h>
  17.  
  18. /*****************************************************************************/
  19.  
  20. #include "Assert.h"
  21.  
  22. /*****************************************************************************/
  23.  
  24. VOID
  25. LT_SetAttributes(LayoutHandle *handle,LONG id,...)
  26. {
  27.     va_list VarArgs;
  28.  
  29.     va_start(VarArgs,id);
  30.     LT_SetAttributesA(handle,id,(struct TagItem *)VarArgs);
  31.     va_end(VarArgs);
  32. }
  33.  
  34.  
  35. /*****************************************************************************/
  36.  
  37.  
  38. VOID
  39. LTP_AddAllAndRefreshThisGadget(LayoutHandle *Handle,struct Gadget *Gadget)
  40. {
  41.     AddGList(Handle->Window,Handle->List,(UWORD)-1,(UWORD)-1,NULL);
  42.     RefreshGList(Gadget,Handle->Window,NULL,1);
  43. }
  44.  
  45. VOID
  46. LTP_FixState(LayoutHandle *Handle,BOOL State,struct Gadget *Gadget,UWORD Bit)
  47. {
  48.     if(Gadget)
  49.     {
  50.         LTP_StripGadgets(Handle,Handle->List);
  51.  
  52.         if(State)
  53.             Gadget->Flags |=  Bit;
  54.         else
  55.             Gadget->Flags &= ~Bit;
  56.  
  57.         LTP_AddAllAndRefreshThisGadget(Handle,Gadget);
  58.     }
  59. }
  60.  
  61. BOOL
  62. LTP_NotifyPager(LayoutHandle *Handle,LONG ID,LONG Page)
  63. {
  64.     if(ID != -1)
  65.     {
  66.         LT_SetAttributes(Handle,ID,
  67.             LAGR_ActivePage,Page,
  68.         TAG_DONE);
  69.  
  70.         if(Handle->Failed)
  71.             return(FALSE);
  72.     }
  73.  
  74.     return(TRUE);
  75. }
  76.  
  77.  
  78. /*****************************************************************************/
  79.  
  80.  
  81. /****** gtlayout.library/LT_SetAttributesA ******************************************
  82. *
  83. *   NAME
  84. *    LT_SetAttributesA -- Change object attributes
  85. *
  86. *   SYNOPSIS
  87. *    LT_SetAttributesA(Handle,ID,Tags);
  88. *                        A0   D0  A1
  89. *
  90. *    VOID LT_SetAttributes(LayoutHandle *,LONG,struct TagItem *);
  91. *
  92. *    LT_SetAttributes(Handle,ID,...);
  93. *
  94. *    VOID LT_SetAttributes(LayoutHandle *,LONG,...);
  95. *
  96. *   FUNCTION
  97. *    This routine passes the tag item list it gets directly
  98. *    over to GT_SetGadgetAttrsA(), so any tag items valid for
  99. *    gadtools.library can be used here as well. Some filtering
  100. *    may be done in order to stop objects from getting redrawn
  101. *    if this is not absolutely necessary.
  102. *
  103. *   INPUTS
  104. *    Handle - Pointer to LayoutHandle.
  105. *
  106. *    ID - ID number of the object to change. This is the same value
  107. *        you passed via LA_ID to LT_New() when you created this object.
  108. *
  109. *    Tags - Attributes controlling object states.
  110. *
  111. *
  112. *    All gadtools.library tags are allowed, but not all are supported.
  113. *    In addition to these tags a few additional tag values are
  114. *    supported:
  115. *
  116. *    LAHN_AutoActivate (BOOL) - Set to TRUE if you want the interface
  117. *        to always keep a string gadget active if possible. Hitting
  118. *        the return key will then cause the next following string
  119. *        gadget to get activated, either cycling through all the
  120. *        string gadgets available or stopping at the next string
  121. *        gadget to have the LAST_LastGadget attribute set.
  122. *
  123. *    LAHN_UserData (APTR) - Store user specific data in the
  124. *        LayoutHandle->UserData entry. (V9)
  125. *
  126. *    LAHN_RawKeyFilter (BOOL) - Discard unprocessed IDCMP_RAWKEY
  127. *        events. (V13)
  128. *        Default: TRUE
  129. *
  130. *    LAHN_LocaleHook (struct Hook *) - The hook to call when
  131. *        locale string IDs are to be mapped to strings. The
  132. *        hook function is called with the following parameters:
  133. *
  134. *        String = HookFunc(struct Hook *Hook,struct LayoutHandle *Handle,
  135. *          D0                            A0                         A2
  136. *                          LONG ID)
  137. *                               A1
  138. *
  139. *        The function is to look up the string associated with the ID
  140. *        passed in and return the string.
  141. *
  142. *    LAHN_ExitFlush (BOOL) - When the LayoutHandle is finally disposed
  143. *        of with LT_DeleteHandle() all variables maintained by the
  144. *        input handling code will be flushed. For example, if you
  145. *        would use the LA_STRPTR tag for STRING_KIND objects the
  146. *        last string gadget contents would be copied into the buffer
  147. *        pointed to by LA_STRPTR. If you do not want to use this
  148. *        feature, disable it with "LAHN_ExitFlush,FALSE". (V9)
  149. *        Default: TRUE
  150. *
  151. *    GAUGE_KIND:
  152. *
  153. *        LAGA_Percent (LONG) - Percentage of the gauge to fill.
  154. *
  155. *        LAGA_InfoText (STRPTR) - Text to be printed within the
  156. *            gauge display, such as a percentage number.
  157. *
  158. *    BOX_KIND:
  159. *
  160. *        LABX_Index (LONG) - The number of the line to change, this
  161. *            tag works in conjunction with the LABX_Text tag.
  162. *
  163. *        LABX_Text (STRPTR) - The text to put into the line indicated
  164. *            by the LABX_Index tag.
  165. *            As of v26 the LABX_Index tag may be omitted, the library
  166. *            will then assume the line index will be 0.
  167. *
  168. *        LABX_Lines (STRPTR *) - The text to set for the box contents,
  169. *            terminate the text array with NULL.
  170. *
  171. *    HORIZONTAL_KIND:
  172. *    VERTICAL_KIND:
  173. *
  174. *        LAGR_ActivePage (LONG) - Index number of page to display
  175. *            within the group.
  176. *
  177. *                NOTE: requires that this group was created
  178. *                    with the LAGR_ActivePage attribute set.
  179. *
  180. *    INTEGER_KIND:
  181. *
  182. *        LAIN_Min (LONG) - Minimum allowed value for this
  183. *            object.
  184. *
  185. *        LAIN_Max (LONG) - Maximum allowed value for this
  186. *            object.
  187. *
  188. *    LISTVIEW_KIND:
  189. *
  190. *        LALV_Selected (LONG) - Combines GTLV_Selected and
  191. *            GTLV_Top (for Kickstart V37) or GTLV_MakeVisible
  192. *            (for Kickstart V39 and greater). This means, the
  193. *            list display will be changed in order to show
  194. *            the item to be selected. (V34)
  195. *
  196. *    LEVEL_KIND:
  197. *
  198. *        LAVL_NumTicks (WORD) - Number of tick marks to draw
  199. *           next to the slider body.
  200. *
  201. *    PASSWORD_KIND:
  202. *
  203. *        LAPW_String (STRPTR) - Secret text to use
  204. *
  205. *    POPUP_KIND
  206. *
  207. *        LAPU_Labels (STRPTR *) - To block access to the popup
  208. *            menu, for example before you free the current list
  209. *            of labels, you can pass ~0 as the list parameter. (V25)
  210. *
  211. *    STRING_KIND:
  212. *
  213. *        LAST_CursorPosition (LONG) - Repositions the cursor,
  214. *            pass -1 to move it to the end of the string. (V7)
  215. *
  216. *    TAPEDECK_KIND:
  217. *
  218. *        LATD_Pressed (BOOL) - TRUE to make this button shown
  219. *            as pressed, FALSE to show it in depressed state.
  220. *
  221. *    BOOPSI_KIND:
  222. *
  223. *        All tags are passed straight through to SetGadgetAttrs(..).
  224. *
  225. *    All objects:
  226. *
  227. *        LA_LabelText (STRPTR) - New gadget label text to use.
  228. *
  229. *        LA_LabelID (LONG) - Locale text ID to use for this object.
  230. *
  231. *   RESULT
  232. *    none
  233. *
  234. *   SEE ALSO
  235. *    gadtools.library/GT_SetGadgetAttrsA()
  236. *    intuition.library/SetGadgetAttrsA
  237. *
  238. ******************************************************************************
  239. *
  240. */
  241.  
  242. VOID LIBENT
  243. LT_SetAttributesA(REG(a0) LayoutHandle *handle,REG(d0) LONG id,REG(a1) struct TagItem *TagList)
  244. {
  245.     if(handle && TagList)
  246.     {
  247.         struct Gadget    *Gadget = NULL;
  248.         struct TagItem    *ThisTag,*ThisList = TagList;
  249.         ObjectNode        *Node = NULL;
  250.  
  251.         while(ThisTag = NextTagItem(&ThisList))
  252.         {
  253.             switch(ThisTag->ti_Tag)
  254.             {
  255.                 case LH_AutoActivate:
  256.  
  257.                     handle->AutoActivate = ThisTag->ti_Data;
  258.                     break;
  259.  
  260.                 case LH_RawKeyFilter:
  261.  
  262.                     handle->RawKeyFilter = ThisTag->ti_Data;
  263.                     break;
  264.  
  265.                 case LH_UserData:
  266.  
  267.                     handle->UserData = (APTR)ThisTag->ti_Data;
  268.                     break;
  269.  
  270.                 case LH_ExitFlush:
  271.  
  272.                     handle->ExitFlush = ThisTag->ti_Data;
  273.                     break;
  274.  
  275.                 case LH_LocaleHook:
  276.  
  277.                     handle->LocaleHook = (struct Hook *)ThisTag->ti_Data;
  278.                     break;
  279.  
  280.                 case LAPR_Gadget:
  281.  
  282.                     Gadget = (struct Gadget *)ThisTag->ti_Data;
  283.                     break;
  284.  
  285.                 case LAPR_Object:
  286.  
  287.                     Node = (ObjectNode *)ThisTag->ti_Data;
  288.                     break;
  289.             }
  290.         }
  291.  
  292.         if(Node)
  293.             Gadget = Node->Host;
  294.         else
  295.         {
  296.             if(Gadget)
  297.             {
  298.                 if(Node = (ObjectNode *)Gadget->UserData)
  299.                 {
  300.                     if(Node->Host != Gadget || Node->PointBack != Node)
  301.                         Node = NULL;
  302.                 }
  303.             }
  304.         }
  305.  
  306.         if(!Gadget)
  307.         {
  308.             if(Gadget = LTP_FindGadget(handle,id))
  309.             {
  310.                 if(Node = (ObjectNode *)Gadget->UserData)
  311.                 {
  312.                     if(Node->Host != Gadget || Node->PointBack != Node)
  313.                         Node = NULL;
  314.                 }
  315.             }
  316.             else
  317.                 Node = LTP_FindNode(handle,id);
  318.         }
  319.  
  320.         if(Node)
  321.         {
  322.             STATIC const Tag Filter[2] = { GA_Disabled,TAG_DONE };
  323.  
  324.             struct TagItem    *NewTags = NULL;
  325.             ULONG             Exclude = NULL;
  326.  
  327.             switch(Node->Type)
  328.             {
  329.                 #ifdef DO_PASSWORD_KIND
  330.                 {
  331.                     case PASSWORD_KIND:
  332.  
  333.                         if(ThisTag = FindTagItem(GTST_String,TagList))
  334.                         {
  335.                             STRPTR String;
  336.                             LONG Len;
  337.  
  338.                             String = (STRPTR)TagList->ti_Data;
  339.  
  340.                             if(String)
  341.                                 Len = strlen(String);
  342.                             else
  343.                             {
  344.                                 String = "";
  345.                                 Len = 0;
  346.                             }
  347.  
  348.                             Exclude = GTST_String;
  349.  
  350.                             strcpy(Node->Special.String.RealString,String);
  351.  
  352.                             if(Len)
  353.                             {
  354.                                 memset(Node->Special.String.Original,'·',Len);
  355.                                 Node->Special.String.Original[Len] = 0;
  356.                             }
  357.  
  358.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  359.                                 GTST_String,Node->Special.String.Original,
  360.                             TAG_DONE);
  361.                         }
  362.  
  363.                         break;
  364.                 }
  365.                 #endif
  366.  
  367.                 #ifdef DO_BOOPSI_KIND
  368.                 {
  369.                     case BOOPSI_KIND:
  370.  
  371.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  372.                             Node->Disabled = ThisTag->ti_Data;
  373.  
  374.                         if(Node->Special.BOOPSI.TagCurrent)
  375.                         {
  376.                             if(ThisTag = FindTagItem(Node->Special.BOOPSI.TagCurrent,TagList))
  377.                                 Node->Current = ThisTag->ti_Data;
  378.                         }
  379.  
  380.                         if(Node->Host)
  381.                             SetGadgetAttrsA(Node->Host,handle->Window,NULL,TagList);
  382.  
  383.                         return;
  384.                 }
  385.                 #endif    /* DO_BOOPSI_KIND */
  386.  
  387.                 case STRING_KIND:
  388.                 case FRACTION_KIND:
  389.  
  390.                     if(ThisTag = FindTagItem(GTST_String,TagList))
  391.                     {
  392.                         Exclude = GTST_String;
  393.  
  394.                         if(Gadget)
  395.                         {
  396.                             STRPTR String;
  397.  
  398.                             String = (STRPTR)ThisTag->ti_Data;
  399.  
  400.                             if(Node->Type == FRACTION_KIND)
  401.                             {
  402.                                 UBYTE DecimalPoint;
  403.  
  404.                                 LTP_CopyFraction(Node->Special.String.RealString,String);
  405.                                 String = Node->Special.String.RealString;
  406.  
  407.                                 DecimalPoint = LTP_DecimalPoint[0];
  408.  
  409.                                 if(DecimalPoint != '.')
  410.                                 {
  411.                                     LONG i;
  412.  
  413.                                     for(i = 0 ; i < strlen(String) ; i++)
  414.                                     {
  415.                                         if(String[i] == '.')
  416.                                         {
  417.                                             String[i] = DecimalPoint;
  418.                                             break;
  419.                                         }
  420.                                     }
  421.                                 }
  422.                             }
  423.  
  424.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  425.                                 GTST_String,String,
  426.                             TAG_DONE);
  427.                         }
  428.                         else
  429.                         {
  430.                             if(!Node->Special.String.Backup)
  431.                                 Node->Special.String.Backup = (STRPTR)LTP_Alloc(handle,Node->Special.String.MaxChars + 1);
  432.  
  433.                             if(Node->Special.String.Backup)
  434.                             {
  435.                                 if(ThisTag->ti_Data)
  436.                                     strcpy(Node->Special.String.Backup,(STRPTR)ThisTag->ti_Data);
  437.                                 else
  438.                                     Node->Special.String.Backup[0] = 0;
  439.  
  440.                                 Node->Special.String.String = Node->Special.String.Backup;
  441.                             }
  442.                         }
  443.                     }
  444.  
  445.                     if(Gadget)
  446.                     {
  447.                         if(ThisTag = FindTagItem(LAST_CursorPosition,TagList))
  448.                         {
  449.                             struct StringInfo    *StringInfo = Gadget->SpecialInfo;
  450.                             LONG                 Position,Len;
  451.  
  452.                             LTP_StripGadgets(handle,handle->List);
  453.  
  454.                             Position = (LONG)ThisTag->ti_Data;
  455.  
  456.                             Len = strlen(StringInfo->Buffer);
  457.  
  458.                             if(Position == -1)
  459.                                 Position = Len;
  460.                             else
  461.                             {
  462.                                 if(Position < 0)
  463.                                     Position = 0;
  464.                                 else
  465.                                 {
  466.                                     if(Position > Len)
  467.                                         Position = Len;
  468.                                 }
  469.                             }
  470.  
  471.                             StringInfo->BufferPos = Position;
  472.  
  473.                             LTP_AddAllAndRefreshThisGadget(handle,Gadget);
  474.                         }
  475.                     }
  476.  
  477.                     break;
  478.  
  479.                 #ifdef DO_LEVEL_KIND
  480.                 {
  481.                     case LEVEL_KIND:
  482.                     {
  483.                         LevelExtra    *Special    = &Node->Special.Level;
  484.                         LONG         Level        = Node->Current,
  485.                                      Min        = Node->Min,
  486.                                      Max        = Node->Max,
  487.                                      Plus        = Special->Plus;
  488.                         BOOL         ChangeIt    = FALSE;
  489.  
  490.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  491.                         {
  492.                             if(Node->Disabled != ThisTag->ti_Data)
  493.                             {
  494.                                 Node->Disabled = ThisTag->ti_Data;
  495.  
  496.                                 ChangeIt = TRUE;
  497.                             }
  498.                         }
  499.  
  500.                         if(ThisTag = FindTagItem(LAVL_Level,TagList))
  501.                         {
  502.                             if((LONG)ThisTag->ti_Data != Level)
  503.                             {
  504.                                 Level = (LONG)ThisTag->ti_Data;
  505.  
  506.                                 ChangeIt = TRUE;
  507.                             }
  508.                         }
  509.  
  510.                         if(ThisTag = FindTagItem(LAVL_Min,TagList))
  511.                         {
  512.                             if((LONG)ThisTag->ti_Data != Min)
  513.                             {
  514.                                 Plus = Min = (LONG)ThisTag->ti_Data;
  515.  
  516.                                 ChangeIt = TRUE;
  517.                             }
  518.                         }
  519.  
  520.                         if(ThisTag = FindTagItem(LAVL_Max,TagList))
  521.                         {
  522.                             if((LONG)ThisTag->ti_Data != Max)
  523.                             {
  524.                                 Max = (LONG)ThisTag->ti_Data;
  525.  
  526.                                 ChangeIt = TRUE;
  527.                             }
  528.                         }
  529.  
  530.                         if(ThisTag = FindTagItem(LAVL_NumTicks,TagList))
  531.                         {
  532.                             WORD Value = (WORD)ThisTag->ti_Data;
  533.  
  534.                             if(Value != Node->Special.Level.Ticks)
  535.                             {
  536.                                 Node->Special.Level.NumTicks = Value;
  537.                                 ChangeIt = TRUE;
  538.                             }
  539.                         }
  540.  
  541.                         if(Max < Min)
  542.                         {
  543.                             Max = Min;
  544.                             ChangeIt = TRUE;
  545.                         }
  546.  
  547.                         if(Level > Max)
  548.                         {
  549.                             Level = Max;
  550.                             ChangeIt = TRUE;
  551.                         }
  552.  
  553.                         if(Level < Min)
  554.                         {
  555.                             Level = Min;
  556.                             ChangeIt = TRUE;
  557.                         }
  558.  
  559.                         if(ChangeIt)
  560.                         {
  561.                             Node->Current    = Level;
  562.                             Node->Min        = Min;
  563.                             Node->Max        = Max;
  564.                             Special->Plus    = Plus;
  565.  
  566.                             LTP_PutStorage(Node);
  567.  
  568.                             if(Gadget && handle->Window)
  569.                             {
  570.                                 LONG Current;
  571.  
  572.                                 if(Node->Special.Level.Freedom == FREEVERT)
  573.                                     Current = Node->Max - Node->Current;
  574.                                 else
  575.                                     Current = Node->Current;
  576.  
  577.                                 SetGadgetAttrs(Gadget,handle->Window,NULL,
  578.                                     GA_Disabled,    Node->Disabled,
  579.                                     SLA_Current,    Current        - Plus,
  580.                                     SLA_Max,        Node->Max    - Plus,
  581.                                     SLA_NumTicks,    Node->Special.Level.NumTicks,
  582.                                 TAG_DONE);
  583.  
  584.                                 LTP_LevelGadgetDrawLabel(handle,Node,FALSE);
  585.                             }
  586.                         }
  587.  
  588.                         break;
  589.                     }
  590.                 }
  591.                 #endif    /* DO_LEVEL_KIND */
  592.  
  593.                 case CHECKBOX_KIND:
  594.  
  595.                     if(ThisTag = FindTagItem(GTCB_Checked,TagList))
  596.                     {
  597.                         if((Node->Current && ThisTag->ti_Data) || (!Node->Current && !ThisTag->ti_Data))
  598.                             Exclude = GTCB_Checked;
  599.                         else
  600.                         {
  601.                             Node->Current = ThisTag->ti_Data;
  602.  
  603.                             LTP_PutStorage(Node);
  604.                         }
  605.                     }
  606.  
  607.                     break;
  608.  
  609.                 #ifdef DO_TAPEDECK_KIND
  610.                 {
  611.                     case TAPEDECK_KIND:
  612.  
  613.                         if(ThisTag = FindTagItem(LATD_Pressed,TagList))
  614.                         {
  615.                             if(Node->Current != ThisTag->ti_Data && Node->Special.TapeDeck.Toggle)
  616.                             {
  617.                                 Node->Current = ThisTag->ti_Data;
  618.  
  619.                                 LTP_FixState(handle,Node->Current,Gadget,GFLG_SELECTED);
  620.                             }
  621.                         }
  622.  
  623.                         break;
  624.                 }
  625.                 #endif    /* DO_TAPEDECK_KIND */
  626.  
  627.                 #ifdef DO_GAUGE_KIND
  628.                 {
  629.                     case GAUGE_KIND:
  630.                     {
  631.                         LONG Percent         = (LONG)Node->Current;
  632.                         BOOL NeedRefresh    = FALSE;
  633.                         BOOL FullRefresh    = FALSE;
  634.  
  635.                         if(ThisTag = FindTagItem(LAGA_Percent,TagList))
  636.                         {
  637.                             Percent = (LONG)ThisTag->ti_Data;
  638.  
  639.                             if(Percent < 0)
  640.                                 Percent = 0;
  641.                             else
  642.                             {
  643.                                 if(Percent > 100)
  644.                                     Percent = 100;
  645.                             }
  646.  
  647.                             if(Percent != (LONG)Node->Current)
  648.                                 NeedRefresh = TRUE;
  649.                         }
  650.  
  651.                         if(ThisTag = FindTagItem(LAGA_InfoText,TagList))
  652.                         {
  653.                             STRPTR SomeText = (STRPTR)ThisTag->ti_Data;
  654.  
  655.                             if(Node->Special.Gauge.InfoLength)
  656.                             {
  657.                                 LONG Len = strlen(SomeText);
  658.  
  659.                                 if(Len > Node->Special.Gauge.InfoLength)
  660.                                     Len = Node->Special.Gauge.InfoLength;
  661.  
  662.                                 CopyMem(SomeText,Node->Special.Gauge.InfoText,Len);
  663.  
  664.                                 Node->Special.Gauge.InfoText[Len] = 0;
  665.  
  666.                                 NeedRefresh = TRUE;
  667.                             }
  668.                         }
  669.  
  670.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  671.                         {
  672.                             if(Node->Disabled != ThisTag->ti_Data)
  673.                             {
  674.                                 FullRefresh = Node->Disabled;
  675.                                 NeedRefresh = TRUE;
  676.  
  677.                                 Node->Disabled = ThisTag->ti_Data;
  678.                             }
  679.                         }
  680.  
  681.                         if(NeedRefresh && Gadget)
  682.                             LTP_DrawGauge(handle,Node,Percent,FullRefresh);
  683.                     }
  684.  
  685.                     return;
  686.                 }
  687.                 #endif
  688.  
  689.                 case LISTVIEW_KIND:
  690.  
  691.                     if(ThisTag = FindTagItem(GTLV_Labels,TagList))
  692.                     {
  693.                         Node->Special.List.Labels = (struct List *)ThisTag->ti_Data;
  694.  
  695.                         if(ThisTag->ti_Data == (ULONG)~0)
  696.                             Node->Min = Node->Max = -1;
  697.                         else
  698.                         {
  699.                             struct List    *List;
  700.                             LONG         Count = 0;
  701.                             struct Node    *Item;
  702.  
  703.                             if(ThisTag->ti_Data)
  704.                                 List = (struct List *)ThisTag->ti_Data;
  705.                             else
  706.                             {
  707.                                 STATIC const Tag Filter[2] = { GTLV_Labels,TAG_DONE };
  708.  
  709.                                 LONG Current = (LONG)GetTagData(GTLV_Selected,(ULONG)Node->Current,TagList);
  710.  
  711.                                 if(!NewTags)
  712.                                 {
  713.                                     if(!(NewTags = CloneTagItems(TagList)))
  714.                                         return;
  715.                                 }
  716.  
  717.                                 FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  718.  
  719.                                 List = (struct List *)<P_EmptyList;
  720.  
  721.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  722.                                     GTLV_Labels,    List,
  723.                                     GTLV_Selected,    Current,
  724.                                 TAG_DONE);
  725.  
  726.                                 Node->Special.List.Labels = List;
  727.  
  728.                                 DB(kprintf("GTLV_Labels: current = %ld\n",Current));
  729.                             }
  730.  
  731.                             SCANLIST(List,Item)
  732.                             {
  733.                                 Count++;
  734.                             }
  735.  
  736.                             Node->Min = 0;
  737.  
  738.                             if(Count)
  739.                                 Node->Max = Count - 1;
  740.                             else
  741.                                 Node->Max = 0;
  742.                         }
  743.                     }
  744.  
  745.                     if(ThisTag = FindTagItem(GTLV_Selected,TagList))
  746.                     {
  747.                         Node->Current = (LONG)ThisTag->ti_Data;
  748.  
  749.                         if(Gadget)
  750.                         {
  751.                             Exclude = GTLV_Selected;
  752.  
  753.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  754.                                 GTLV_Selected,        Node->Current,
  755.                                 GTLV_Labels,        Node->Special.List.Labels,
  756.                             TAG_DONE);
  757.                         }
  758.  
  759.                         LTP_PutStorage(Node);
  760.  
  761.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  762.                             return;
  763.                     }
  764.  
  765.                     if(ThisTag = FindTagItem(LALV_Selected,TagList))
  766.                     {
  767.                         Node->Current = (LONG)ThisTag->ti_Data;
  768.  
  769.                         if(Gadget)
  770.                         {
  771.                             ULONG WhichTag;
  772.  
  773.                             if(V39)
  774.                                 WhichTag = GTLV_MakeVisible;
  775.                             else
  776.                                 WhichTag = GTLV_Top;
  777.  
  778.                             Exclude = LALV_Selected;
  779.  
  780.                             GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  781.                                 GTLV_Selected,        Node->Current,
  782.                                 GTLV_Labels,        Node->Special.List.Labels,
  783.  
  784.                                 (Node->Current < 0) ? TAG_DONE : TAG_IGNORE,0,
  785.  
  786.                                 WhichTag,            Node->Current,
  787.                             TAG_DONE);
  788.                         }
  789.  
  790.                         LTP_PutStorage(Node);
  791.  
  792.                         if(!LTP_NotifyPager(handle,Node->Special.List.AutoPageID,Node->Current))
  793.                             return;
  794.                     }
  795.  
  796.                     if(ThisTag = FindTagItem(GA_Disabled,TagList))
  797.                     {
  798.                         if(!V39)
  799.                         {
  800.                             if(!NewTags)
  801.                             {
  802.                                 if(!(NewTags = CloneTagItems(TagList)))
  803.                                     return;
  804.                             }
  805.  
  806.                             FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  807.                         }
  808.                     }
  809.  
  810.                     break;
  811.  
  812.                 case MX_KIND:
  813.  
  814.                     if(ThisTag = FindTagItem(GTMX_Active,TagList))
  815.                     {
  816.                         if(Node->Current == ThisTag->ti_Data)
  817.                             Exclude = GTMX_Active;
  818.                         else
  819.                         {
  820.                             Node->Current = ThisTag->ti_Data;
  821.  
  822.                             LTP_PutStorage(Node);
  823.  
  824.                             if(!LTP_NotifyPager(handle,Node->Special.Radio.AutoPageID,Node->Current))
  825.                                 return;
  826.                         }
  827.                     }
  828.  
  829.                     if(!V39)
  830.                     {
  831.                         if(FindTagItem(GA_Disabled,TagList))
  832.                         {
  833.                             if(!(NewTags = CloneTagItems(TagList)))
  834.                                 return;
  835.                             else
  836.                                 FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  837.                         }
  838.                     }
  839.  
  840.                     break;
  841.  
  842.                 case CYCLE_KIND:
  843.  
  844.                     if(ThisTag = FindTagItem(GTCY_Active,TagList))
  845.                     {
  846.                         if(Node->Current == (LONG)ThisTag->ti_Data)
  847.                             Exclude = GTCY_Active;
  848.                         else
  849.                         {
  850.                             Node->Current = (LONG)ThisTag->ti_Data;
  851.  
  852.                             LTP_PutStorage(Node);
  853.  
  854.                             if(!LTP_NotifyPager(handle,Node->Special.Cycle.AutoPageID,Node->Current))
  855.                                 return;
  856.                         }
  857.                     }
  858.  
  859.                     if(ThisTag = FindTagItem(GTCY_Labels,TagList))
  860.                     {
  861.                         STRPTR    *Strings;
  862.                         LONG     Count = 0;
  863.  
  864.                         if(Strings = (STRPTR *)ThisTag->ti_Data)
  865.                         {
  866.                             while(Strings[Count])
  867.                                 Count++;
  868.                         }
  869.  
  870.                         if(Count)
  871.                             Node->Max = Count - 1;
  872.                         else
  873.                             Node->Max = 0;
  874.                     }
  875.  
  876.                     break;
  877.  
  878.                 #ifdef DO_POPUP_KIND
  879.                 {
  880.                     case POPUP_KIND:
  881.                     {
  882.                         BOOL NewCurrent = FALSE,NewLabels = FALSE;
  883.  
  884.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  885.                             Node->Disabled = ThisTag->ti_Data;
  886.  
  887.                         if(ThisTag = FindTagItem(LAPU_Labels,TagList))
  888.                         {
  889.                             STRPTR    *Strings;
  890.                             LONG     Count = 0;
  891.  
  892.                             if(Strings = (STRPTR *)ThisTag->ti_Data)
  893.                             {
  894.                                 while(Strings[Count])
  895.                                     Count++;
  896.                             }
  897.  
  898.                             if(Count)
  899.                                 Node->Max = Count - 1;
  900.                             else
  901.                                 Node->Max = 0;
  902.  
  903.                             Node->Special.Popup.Choices = (STRPTR *)ThisTag->ti_Data;
  904.  
  905.                             DB(kprintf("max: %ld\n",Node->Max));
  906.  
  907.                             NewLabels = TRUE;
  908.                         }
  909.  
  910.                         if(ThisTag = FindTagItem(LAPU_Active,TagList))
  911.                         {
  912.                             DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  913.  
  914.                             if(Node->Current != ThisTag->ti_Data)
  915.                             {
  916.                                 Node->Current = ThisTag->ti_Data;
  917.  
  918.                                 LTP_PutStorage(Node);
  919.  
  920.                                 if(!LTP_NotifyPager(handle,Node->Special.Popup.AutoPageID,Node->Current))
  921.                                     return;
  922.  
  923.                                 NewCurrent = TRUE;
  924.                             }
  925.                         }
  926.  
  927.                         if(Node->Host)
  928.                         {
  929.                             SetGadgetAttrs(Node->Host,handle->Window,NULL,
  930.                                 NewCurrent ? PIA_Active : TAG_IGNORE,    Node->Current,
  931.                                 NewLabels ? PIA_Labels : TAG_IGNORE,    Node->Special.Popup.Choices,
  932.                             TAG_MORE,TagList);
  933.                         }
  934.  
  935.                         return;
  936.                     }
  937.                 }
  938.                 #endif
  939.  
  940.                 #ifdef DO_TAB_KIND
  941.                 {
  942.                     case TAB_KIND:
  943.                     {
  944.                         if(ThisTag = FindTagItem(GA_Disabled,TagList))
  945.                             Node->Disabled = ThisTag->ti_Data;
  946.  
  947.                         if(ThisTag = FindTagItem(LATB_Active,TagList))
  948.                         {
  949.                             DB(kprintf("current: %ld tag: %ld\n",Node->Current,ThisTag->ti_Data));
  950.  
  951.                             if(Node->Current != ThisTag->ti_Data)
  952.                             {
  953.                                 Node->Current = ThisTag->ti_Data;
  954.  
  955.                                 LTP_PutStorage(Node);
  956.  
  957.                                 if(!LTP_NotifyPager(handle,Node->Special.Tab.AutoPageID,Node->Current))
  958.                                     return;
  959.                                 else
  960.                                 {
  961.                                     if(Node->Host)
  962.                                     {
  963.                                         SetGadgetAttrs(Node->Host,handle->Window,NULL,
  964.                                             TIA_Index,Node->Current,
  965.                                         TAG_MORE,TagList);
  966.                                     }
  967.                                 }
  968.                             }
  969.                         }
  970.  
  971.                         return;
  972.                     }
  973.                 }
  974.                 #endif
  975.  
  976.                 case PALETTE_KIND:
  977.  
  978.                     if(ThisTag = FindTagItem(GTPA_Color,TagList))
  979.                     {
  980.                         if(Node->Current == ThisTag->ti_Data)
  981.                             Exclude = GTPA_Color;
  982.                         else
  983.                         {
  984.                             Node->Current = ThisTag->ti_Data;
  985.  
  986.                             LTP_PutStorage(Node);
  987.  
  988.                             if(Node->Special.Palette.UsePicker)
  989.                             {
  990.                                 if(Gadget)
  991.                                     LTP_DrawPalette(handle,Node);
  992.  
  993.                                 return;
  994.                             }
  995.                         }
  996.                     }
  997.  
  998.                     break;
  999.  
  1000.                 case INTEGER_KIND:
  1001.  
  1002.                     if(ThisTag = FindTagItem(GTIN_Number,TagList))
  1003.                     {
  1004.                         LONG num = ThisTag->ti_Data;
  1005.  
  1006.                         if(num < Node->Min)
  1007.                             num = Node->Min;
  1008.                         else
  1009.                         {
  1010.                             if(num > Node->Max)
  1011.                                 num = Node->Max;
  1012.                         }
  1013.  
  1014.                         if(Gadget)
  1015.                         {
  1016.                             #ifdef DO_HEXHOOK
  1017.                             {
  1018.                                 if(!Node->Special.Integer.EditHook || Node->Special.Integer.CustomHook)
  1019.                                 {
  1020.                                     UBYTE                 buffer[20];
  1021.                                     struct StringInfo    *stringInfo;
  1022.  
  1023.                                     SPrintf(buffer,"%ld",num);
  1024.  
  1025.                                     Exclude = GTIN_Number;
  1026.  
  1027.                                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1028.                                         GTST_String,    buffer,
  1029.                                         GTIN_Number,    num,
  1030.                                     TAG_DONE);
  1031.  
  1032.                                     stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  1033.  
  1034.                                     stringInfo->LongInt = num;
  1035.                                 }
  1036.                                 else
  1037.                                 {
  1038.                                     UBYTE                 buffer[40];
  1039.                                     struct StringInfo    *stringInfo;
  1040.                                     STRPTR                 Index;
  1041.                                     LONG                 Value,Number = num,
  1042.                                                          Scale,Sign;
  1043.  
  1044.                                     stringInfo = (struct StringInfo *)Gadget->SpecialInfo;
  1045.  
  1046.                                     Index = stringInfo->Buffer;
  1047.  
  1048.                                     while(*Index && *Index == ' ')
  1049.                                         Index++;
  1050.  
  1051.                                     switch(Index[0])
  1052.                                     {
  1053.                                         case '$':
  1054.  
  1055.                                             SPrintf(buffer,"$%lx",num);
  1056.                                             break;
  1057.  
  1058.                                         case '&':
  1059.  
  1060.                                             if(Number < 0)
  1061.                                             {
  1062.                                                 Sign = -1;
  1063.                                                 Number = -Number;
  1064.                                             }
  1065.                                             else
  1066.                                                 Sign = 1;
  1067.  
  1068.                                             for(Value = 0, Scale = 1 ; Number ; Number /= 8, Scale *= 10)
  1069.                                                 Value += (Number & 7) * Scale;
  1070.  
  1071.                                             SPrintf(buffer,"&%ld",(LONG)(Sign * Value));
  1072.                                             break;
  1073.  
  1074.                                         case '%':
  1075.  
  1076.                                             if(Number < 0)
  1077.                                             {
  1078.                                                 Sign = -1;
  1079.                                                 Number = -Number;
  1080.                                             }
  1081.                                             else
  1082.                                                 Sign = 1;
  1083.  
  1084.                                             for(Value = 0, Scale = 1 ; Number ; Number /= 2, Scale *= 10)
  1085.                                                 Value += (Number & 1) * Scale;
  1086.  
  1087.                                             SPrintf(buffer,"%%%ld",(LONG)(Sign * Value));
  1088.                                             break;
  1089.  
  1090.                                         case '0':
  1091.  
  1092.                                             if(Index[1] == 'x')
  1093.                                             {
  1094.                                                 SPrintf(buffer,"0x%lx",num);
  1095.                                                 break;
  1096.                                             }
  1097.  
  1098.                                             // Fall through to...
  1099.  
  1100.                                         default:
  1101.  
  1102.                                             SPrintf(buffer,"%ld",num);
  1103.                                             break;
  1104.                                     }
  1105.  
  1106.                                     Exclude = GTIN_Number;
  1107.  
  1108.                                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1109.                                         GTST_String,buffer,
  1110.                                     TAG_DONE);
  1111.  
  1112.                                     stringInfo->LongInt = num;
  1113.                                 }
  1114.                             }
  1115.                             #else
  1116.                             {
  1117.                                 GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1118.                                     GTIN_Number,num,
  1119.                                 TAG_DONE);
  1120.                             }
  1121.                             #endif
  1122.                         }
  1123.  
  1124.                         Node->Special.Integer.Number = num;
  1125.  
  1126.                         LTP_PutStorage(Node);
  1127.                     }
  1128.  
  1129.                     break;
  1130.  
  1131.                 case NUMBER_KIND:
  1132.  
  1133.                     if(ThisTag = FindTagItem(GTNM_Number,TagList))
  1134.                         Node->Special.Number.Number = ThisTag->ti_Data;
  1135.  
  1136.                     break;
  1137.  
  1138.                 case SLIDER_KIND:
  1139.  
  1140.                     if(ThisTag = FindTagItem(GTSL_Level,TagList))
  1141.                     {
  1142.                         if(Node->Current == ThisTag->ti_Data)
  1143.                             Exclude = GTSL_Level;
  1144.                         else
  1145.                         {
  1146.                             Node->Current = ThisTag->ti_Data;
  1147.  
  1148.                             LTP_PutStorage(Node);
  1149.                         }
  1150.                     }
  1151.  
  1152.                     if(ThisTag = FindTagItem(GTSL_Min,TagList))
  1153.                     {
  1154.                         Node->Min = ThisTag->ti_Data;
  1155.  
  1156.                         if(Node->Current < Node->Min)
  1157.                         {
  1158.                             Node->Current = Node->Min;
  1159.  
  1160.                             LTP_PutStorage(Node);
  1161.                         }
  1162.                     }
  1163.  
  1164.                     if(ThisTag = FindTagItem(GTSL_Max,TagList))
  1165.                     {
  1166.                         Node->Max = ThisTag->ti_Data;
  1167.  
  1168.                         if(Node->Current > Node->Max)
  1169.                         {
  1170.                             Node->Current = Node->Max;
  1171.  
  1172.                             LTP_PutStorage(Node);
  1173.                         }
  1174.                     }
  1175.  
  1176.                     break;
  1177.  
  1178.                 case SCROLLER_KIND:
  1179.  
  1180.                     if(ThisTag = FindTagItem(GTSC_Top,TagList))
  1181.                     {
  1182.                         if(Node->Current == ThisTag->ti_Data)
  1183.                             Exclude = GTSC_Top;
  1184.                         else
  1185.                         {
  1186.                             Node->Current = ThisTag->ti_Data;
  1187.  
  1188.                             LTP_PutStorage(Node);
  1189.                         }
  1190.                     }
  1191.  
  1192.                     if(ThisTag = FindTagItem(GTSC_Total,TagList))
  1193.                     {
  1194.                         Node->Max = ThisTag->ti_Data;
  1195.  
  1196.                         if(Node->Current > Node->Max)
  1197.                         {
  1198.                             Node->Current = Node->Max;
  1199.  
  1200.                             LTP_PutStorage(Node);
  1201.                         }
  1202.                     }
  1203.  
  1204.                     if(ThisTag = FindTagItem(GTSC_Visible,TagList))
  1205.                         Node->Special.Scroller.Visible = ThisTag->ti_Data;
  1206.  
  1207.                     break;
  1208.  
  1209.                 case BOX_KIND:
  1210.                 {
  1211.                     BOOL Visible;
  1212.  
  1213.                     if(Node->Special.Box.Parent)
  1214.                         Visible = Node->Special.Box.Parent->Special.Group.Visible;
  1215.                     else
  1216.                         Visible = FALSE;
  1217.  
  1218.                     if(ThisTag = FindTagItem(LABX_Text,TagList))
  1219.                     {
  1220.                         STRPTR    Text = (STRPTR)ThisTag->ti_Data;
  1221.                         LONG    Index;
  1222.  
  1223.                         Index = (LONG)GetTagData(LABX_Index,0,TagList);
  1224.  
  1225.                         if(Index >= 0 && Index < Node->Lines)
  1226.                         {
  1227.                             if(Node->Special.Box.ReserveSpace)
  1228.                             {
  1229.                                 LONG Len = strlen(Text);
  1230.  
  1231.                                 if(Len > Node->Special.Box.MaxSize)
  1232.                                     Len = Node->Special.Box.MaxSize;
  1233.  
  1234.                                 CopyMem(Text,Node->Special.Box.Lines[Index],Len);
  1235.  
  1236.                                 Node->Special.Box.Lines[Index][Len] = 0;
  1237.                             }
  1238.                             else
  1239.                                 Node->Special.Box.Lines[Index] = Text;
  1240.                         }
  1241.  
  1242.                         if(Visible)
  1243.                             LTP_PrintBoxLine(handle,Node,Index);
  1244.                     }
  1245.  
  1246.                     if(ThisTag = FindTagItem(LABX_Lines,TagList))
  1247.                     {
  1248.                         STRPTR    *Lines = (STRPTR *)ThisTag->ti_Data;
  1249.                         LONG     i;
  1250.  
  1251.                         if(Node->Special.Box.ReserveSpace)
  1252.                         {
  1253.                             LONG Len;
  1254.  
  1255.                             for(i = 0 ; i < Node->Lines ; i++)
  1256.                             {
  1257.                                 if(Lines[i])
  1258.                                 {
  1259.                                     Len = strlen(Lines[i]);
  1260.  
  1261.                                     if(Len > Node->Special.Box.MaxSize)
  1262.                                         Len = Node->Special.Box.MaxSize;
  1263.  
  1264.                                     CopyMem(Lines[i],Node->Special.Box.Lines[i],Len);
  1265.  
  1266.                                     Node->Special.Box.Lines[i][Len] = 0;
  1267.  
  1268.                                     if(Visible)
  1269.                                         LTP_PrintBoxLine(handle,Node,i);
  1270.                                 }
  1271.                                 else
  1272.                                     break;
  1273.                             }
  1274.                         }
  1275.                         else
  1276.                         {
  1277.                             for(i = 0 ; i < Node->Lines ; i++)
  1278.                             {
  1279.                                 if(Lines[i])
  1280.                                 {
  1281.                                     Node->Special.Box.Lines[i] = Lines[i];
  1282.  
  1283.                                     if(Visible)
  1284.                                         LTP_PrintBoxLine(handle,Node,i);
  1285.                                 }
  1286.                                 else
  1287.                                     break;
  1288.                             }
  1289.                         }
  1290.                     }
  1291.  
  1292.                     break;
  1293.                 }
  1294.  
  1295.                 case TEXT_KIND:
  1296.  
  1297.                     if(ThisTag = FindTagItem(GTTX_Text,TagList))
  1298.                     {
  1299.                         STRPTR text = (STRPTR)ThisTag->ti_Data;
  1300.  
  1301.                         if(!text)
  1302.                             text = "";
  1303.  
  1304.                         if(Node->Special.Text.CopyText)
  1305.                         {
  1306.                             LONG len;
  1307.  
  1308.                             if(Node->Special.Text.Text)
  1309.                                 len = strlen(Node->Special.Text.Text) + 1;
  1310.                             else
  1311.                                 len = 0;
  1312.  
  1313.                             if(len)
  1314.                                 LTP_Free(handle,Node->Special.Text.Text,len);
  1315.  
  1316.                             len = strlen(text);
  1317.  
  1318.                             if(Node->Special.Text.Text = LTP_Alloc(handle,len + 1))
  1319.                                 strcpy(Node->Special.Text.Text,text);
  1320.                         }
  1321.                         else
  1322.                             Node->Special.Text.Text = text;
  1323.                     }
  1324.  
  1325.                     if(ThisTag = FindTagItem(GTTX_FrontPen,TagList))
  1326.                         Node->Special.Text.FrontPen = (WORD)ThisTag->ti_Data;
  1327.  
  1328.                     if(ThisTag = FindTagItem(GTTX_BackPen,TagList))
  1329.                         Node->Special.Text.BackPen = (WORD)ThisTag->ti_Data;
  1330.  
  1331.                     break;
  1332.  
  1333.                 case GROUP_KIND:
  1334.  
  1335.                     if(Node->Special.Group.Paging)
  1336.                     {
  1337.                         if(ThisTag = FindTagItem(LAGR_ActivePage,TagList))
  1338.                         {
  1339.                             ObjectNode *node;
  1340.  
  1341.                             node = Node;
  1342.  
  1343.                             if(node->Type == GROUP_KIND)
  1344.                             {
  1345.                                 if(node->Special.Group.ActivePage != ThisTag->ti_Data)
  1346.                                 {
  1347.                                     LONG    Left    = node->Left,
  1348.                                             Top        = node->Top,
  1349.                                             Width    = node->Width,
  1350.                                             Height    = node->Height;
  1351.  
  1352.                                     if(node->Label || node->Special.Group.Frame || node->Special.Group.FrameType == FRAMETYPE_Label)
  1353.                                     {
  1354.                                         Left    += 4 + handle->GlyphWidth;
  1355.                                         Width    -= 2 * (4 + handle->GlyphWidth);
  1356.  
  1357.                                         if(node->Label)
  1358.                                         {
  1359.                                             Top        += handle->GlyphHeight;
  1360.                                             Height    -= handle->GlyphHeight + 3;
  1361.                                         }
  1362.                                         else
  1363.                                         {
  1364.                                             Top        += 2;
  1365.                                             Height    -= 5;
  1366.                                         }
  1367.                                     }
  1368.                                     else
  1369.                                     {
  1370.                                         if(node->Special.Group.FrameType == FRAMETYPE_Tab)
  1371.                                         {
  1372.                                             Width    -= 2 * 2;
  1373.                                             Left    += 2;
  1374.                                             Height    -= 1;
  1375.                                         }
  1376.                                     }
  1377.  
  1378.                                     node->Special.Group.ActivePage = ThisTag->ti_Data;
  1379.  
  1380.                                     LT_LockWindow(handle->Window);
  1381.  
  1382.                                     LTP_EraseBox(&handle->RPort,Left,Top,Width,Height);
  1383.  
  1384.                                     LT_RebuildTagList(handle,FALSE,NULL);
  1385.  
  1386.                                     LT_UnlockWindow(handle->Window);
  1387.                                 }
  1388.                             }
  1389.                         }
  1390.                     }
  1391.  
  1392.                     break;
  1393.             }
  1394.  
  1395.             if(ThisTag = FindTagItem(LA_LabelText,TagList))
  1396.                 Node->Label = (STRPTR)ThisTag->ti_Data;
  1397.  
  1398.             if(ThisTag = FindTagItem(LA_LabelID,TagList))
  1399.             {
  1400.                 if(handle->LocaleHook)
  1401.                     Node->Label = (STRPTR)CallHookPkt(handle->LocaleHook,handle,(APTR)ThisTag->ti_Data);
  1402.             }
  1403.  
  1404.             if(ThisTag = FindTagItem(GA_Disabled,TagList))
  1405.             {
  1406.                 if((Node->Disabled && ThisTag->ti_Data) || (!Node->Disabled && !ThisTag->ti_Data))
  1407.                 {
  1408.                     if(!NewTags)
  1409.                         NewTags = CloneTagItems(TagList);
  1410.  
  1411.                     if(NewTags)
  1412.                         FilterTagItems(NewTags,(Tag *)Filter,TAGFILTER_NOT);
  1413.                 }
  1414.                 else
  1415.                 {
  1416.                     Node->Disabled = ThisTag->ti_Data;
  1417.  
  1418.                     if(Gadget)
  1419.                     {
  1420.                         struct Gadget *gad;
  1421.  
  1422.                         switch(Node->Type)
  1423.                         {
  1424.                             case TEXT_KIND:
  1425.  
  1426.                                 gad = Node->Special.Text.Picker;
  1427.                                 break;
  1428.  
  1429.                             case STRING_KIND:
  1430.  
  1431.                                 gad = Node->Special.String.Picker;
  1432.                                 break;
  1433.  
  1434.                             case INTEGER_KIND:
  1435.  
  1436.                                 LTP_FixState(handle,Node->Disabled,Node->Special.Integer.LeftIncrementer,GFLG_DISABLED);
  1437.  
  1438.                                 gad = Node->Special.Integer.RightIncrementer;
  1439.                                 break;
  1440.  
  1441.                             case FRACTION_KIND:
  1442.  
  1443.                                 LTP_FixState(handle,Node->Disabled,Node->Special.String.LeftIncrementer,GFLG_DISABLED);
  1444.  
  1445.                                 gad = Node->Special.String.RightIncrementer;
  1446.                                 break;
  1447.  
  1448.                             case TAPEDECK_KIND:
  1449.  
  1450.                                 gad = Node->Host;
  1451.  
  1452.                                 Gadget = NULL;
  1453.  
  1454.                                 break;
  1455.  
  1456.                             case PALETTE_KIND:
  1457.  
  1458.                                 gad = Node->Special.Palette.Picker;
  1459.                                 break;
  1460.  
  1461.                             case BUTTON_KIND:
  1462.  
  1463.                                 if(Node->Special.Button.ButtonImage)
  1464.                                 {
  1465.                                     gad = Node->Host;
  1466.  
  1467.                                     Gadget = NULL;
  1468.  
  1469.                                     break;
  1470.                                 }
  1471.  
  1472.                                 // FALLS THROUGH TO
  1473.  
  1474.                             default:
  1475.  
  1476.                                 gad = NULL;
  1477.                                 break;
  1478.                         }
  1479.  
  1480.                         LTP_FixState(handle,Node->Disabled,gad,GFLG_DISABLED);
  1481.                     }
  1482.                 }
  1483.             }
  1484.  
  1485.             if(Exclude)
  1486.             {
  1487.                 Tag Filter[2];
  1488.  
  1489.                 Filter[0] = Exclude;
  1490.                 Filter[1] = TAG_DONE;
  1491.  
  1492.                 if(!NewTags)
  1493.                     NewTags = CloneTagItems(TagList);
  1494.  
  1495.                 if(NewTags)
  1496.                     FilterTagItems(NewTags,Filter,TAGFILTER_NOT);
  1497.             }
  1498.  
  1499.             if(Gadget)
  1500.             {
  1501.                 struct TagItem *tags = TagList;
  1502.  
  1503.                 if(NewTags)
  1504.                     tags = NewTags;
  1505.  
  1506.                 if(!V39 && Node->Disabled && Node->Type == SLIDER_KIND)
  1507.                 {
  1508.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1509.                         GA_Disabled,    FALSE,
  1510.                     TAG_MORE,tags);
  1511.  
  1512.                     GT_SetGadgetAttrs(Gadget,handle->Window,NULL,
  1513.                         GA_Disabled,    TRUE,
  1514.                     TAG_DONE);
  1515.                 }
  1516.                 else
  1517.                     GT_SetGadgetAttrsA(Gadget,handle->Window,NULL,tags);
  1518.             }
  1519.  
  1520.             if(LIKE_STRING_KIND(Node))
  1521.                 LTP_PutStorage(Node);
  1522.  
  1523.             FreeTagItems(NewTags);
  1524.         }
  1525.     }
  1526. }
  1527.